package drename;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;

public class ComputeMinIGD {
	public static void main(String[] args) throws IOException {
		String algorithm = "NSGAIII";
		String problems = "DTLZ";
		Integer[] dimensions = {3,5,8,10};
		for(int i = 0;i<7;i++){
			String problem = problems+(i+1);
			String direct = "results/"+algorithm+"/"+problem+"/";
			FileOutputStream output = new FileOutputStream(new File(direct+"min_IGDNEW.log"));
			for(int j = 0;j<dimensions.length;j++)
			{
				String path = direct+dimensions[j]+"M_IGDNEW.log";
				FileReader reader = new FileReader(new File(path));
				BufferedReader buffer = new BufferedReader(reader);
				String str = null;
				
				double min = Double.MAX_VALUE;
				while((str=buffer.readLine())!=null){
					String[] splitStr = str.split(" ");
					if(Double.parseDouble(splitStr[1])<min)
						min = Double.parseDouble(splitStr[1]);
				}
				buffer.close();
				String out = min+"\n";
				output.write(out.getBytes());
			}
			output.close();
			
		}
		System.out.println("end");
	}
}
